package com.fili.gui.components;

import com.fili.core.BatchJob;
import com.fili.core.CompileParam;

import javax.swing.*;
import java.awt.*;

/**
 * Created by Claudiu-Florin FILIMON
 * Date: Oct 6, 2006
 * Time: 1:14:38 PM
 * Revision: 0
 */
public class BatchPanel extends JComponent implements Scrollable
{
    private BatchJob batchJob;
    public ParamGroup[] paramGroup;


    public BatchPanel(BatchJob batchJob)
    {
        this.batchJob = batchJob;

        setLayout(new GridLayout(1,batchJob.params.size()));
        paramGroup = new ParamGroup[batchJob.params.size()];
        for (int i=0;i<batchJob.params.size();i++)
        {
            paramGroup[i] = new ParamGroup((CompileParam) batchJob.params.get(i));
            add(paramGroup[i]);
        }
    }


    public Dimension getPreferredScrollableViewportSize()
    {
        return new Dimension(batchJob.params.size() * 200, 100);
    }


    public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
    {
        return 25;
    }

    public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)
    {
        return 100;
    }

    public boolean getScrollableTracksViewportWidth()
    {
        return false;
    }

    public boolean getScrollableTracksViewportHeight()
    {
        return true;
    }
}
